package com.sample.wheel.gama;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.example.helloworld.R;
import com.sample.wheel.digitalaria.gama.wheel.Wheel;

public class SampleWheelActivity extends Activity {
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sample_wheel_main);
        
        init();
    }

    private Wheel wheel;
    private Resources res; 
    private int[] icons = { 
    		R.drawable.wheel_icon00, R.drawable.wheel_icon01, R.drawable.wheel_icon02, 
    		R.drawable.wheel_icon03, R.drawable.wheel_icon04, R.drawable.wheel_icon05, 
    		R.drawable.wheel_icon06, R.drawable.wheel_icon07, R.drawable.wheel_icon08, 
    		R.drawable.wheel_icon09, R.drawable.wheel_icon10, R.drawable.wheel_icon11 };
    
	private void init() {
		res = getApplicationContext().getResources();
		wheel = (Wheel) findViewById(R.id.wheel);
		
		wheel.setItems(getDrawableFromData(icons));
		wheel.setWheelDiameter(400);
	}
	
	private Drawable[] getDrawableFromData(int[] data) {
		Drawable[] ret = new Drawable[data.length];
		for (int i = 0; i < data.length; i++) {
			ret[i] = res.getDrawable(data[i]);
		}
		return ret;
	}
    
}